<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="admin/css/pintuer.css">
<link rel="stylesheet" href="admin/css/admin.css">
<script src="admin/js/jquery.js"></script>
<script src="admin/js/pintuer.js"></script>
<script src="ckeditor/ckeditor.js"></script>
<script src="ckfinder/ckfinder.js"></script>
<script src="ckeditor/samples/js/sample.js" type="text/javascript"></script>
<link href="ckeditor/samples/sample.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

function checkHtml5(){
	if(window.applicationCache){
		return true;
	}
	else{
		return false;
	}
}
//删除服务
function del(id){
	if(confirm("确定删除id为"+id+"的评论？")){
		$.ajax({url:'admin/delBBSById.do?id='+id,context: document.body,success:function(data){
			alert(data);
			window.location.reload();
		}})
	}
}
</script>  
</head>
<body>
<div class="panel admin-panel margin-top" id="add">
  <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 修改内容</strong></div>
  <div class="body-content">
    <form id="uadv_form" action="admin/uservice.do" method="post" class="form-x" enctype="multipart/form-data"> 
    	<input type="hidden" name="belong" value="2"/>
    	<input type="hidden" name="id" value="${caseInfo.id }"/>
      <div class="form-group">
        <div class="label">
          <label>名称：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" name="title" data-validate="required:请输入名称" value="${caseInfo.title }" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
          <div class="label">
            <label>文件类型：</label>
          </div>
          <input type="hidden" id = "type_value_id" value="${caseInfo.type }">
          <input type="hidden" id = "isneturl_value_id" value="${caseInfo.isneturl }">
          <div class="field">
            <select name="filetype" class="input w50" id="selectfiletype">
              <option value="1">本地图片</option>
            </select>
            <div class="tips"></div>
          </div>
        </div>
        <div class="form-group">
          <div class="label">
            <label>案例所属：</label>
          </div>
          <div class="field">
            <select name="filetype" class="input w50" id="selectServerBelong">
              <option value="${caseInfo.parentId }">${caseInfo.parent.title }</option>
            </select>
            <div class="tips"></div>
          </div>
          
        </div>
      <div class="form-group" id = "showImgdiv">
        <div class="label">
          <label>封面预览：</label>
        </div>
        	<img id="showImg" src="${caseInfo.resource }" width="240" height="100" />
      </div>
      <div class="form-group">
        <div class="label">
          <label>描述：</label>
        </div>
        <div class="field">
          <div id="contentdiv" style="display: none;">${caseInfo.content }</div>
          <textarea class="ckeditor" name="content" id="TextArea1" cols="20" rows="2"></textarea>
          <script type="text/javascript">
			CKEDITOR.replace('TextArea1');
			var content = $('#contentdiv').html();
        	CKEDITOR.instances.TextArea1.setData(content);
			</script>
          <div class="tips"></div>
        </div>
      </div>
      <c:if test="${! empty addRslt }">
      </c:if>
    </form>
  </div>
    <table class="table table-hover text-center">
    <tr>
      <th width="5%">ID</th>
      <th width="20%">评论内容</th>
      <th width="20%">评论时间</th>
      <th width="15%">评论者</th>
      <th width="15%">操作</th>
    </tr>
   	<c:if test="${!empty bbs }">
   		<c:forEach items="${bbs }" var="bbs" varStatus="a">
   			<tr>
      			<td>${bbs.id }</td>     
      			<td>${bbs.content }</td>     
      			<td>${bbs.pubTime }</td>     
      			<td>${bbs.user.userName }</td>
      			<td><div class="button-group">
      			<a class="button border-red" href="javascript:void(0)" onclick="del(${bbs.id})"><span class="icon-trash-o"></span> 删除</a>
      			</div></td>
    		</tr>
   		</c:forEach>
   	</c:if>
  </table>
</div>
</body>
</html>